.class Lcom/estrongs/android/pop/app/filetransfer/n$a;
.super Ljava/lang/Object;
.source "ScanPortTask.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/estrongs/android/pop/app/filetransfer/n;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "a"
.end annotation


# instance fields
.field a:Ljava/lang/String;

.field final synthetic b:Lcom/estrongs/android/pop/app/filetransfer/n;


# direct methods
.method constructor <init>(Lcom/estrongs/android/pop/app/filetransfer/n;Ljava/lang/String;I)V
    .locals 0

    .line 1
    iput-object p1, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-object p2, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->a:Ljava/lang/String;

    return-void
.end method


# virtual methods
.method public run()V
    .locals 9

    .line 1
    new-instance v0, Ljava/net/Socket;

    invoke-direct {v0}, Ljava/net/Socket;-><init>()V

    const/4 v1, 0x0

    .line 2
    :try_start_0
    iget-object v2, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->a:Ljava/lang/String;

    invoke-static {v2}, Ljava/net/InetAddress;->getByName(Ljava/lang/String;)Ljava/net/InetAddress;

    move-result-object v2

    .line 3
    new-instance v3, Ljava/net/InetSocketAddress;

    sget v4, Les/c90;->g:I

    invoke-direct {v3, v2, v4}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V

    const/16 v2, 0x7d0

    invoke-virtual {v0, v3, v2}, Ljava/net/Socket;->connect(Ljava/net/SocketAddress;I)V

    .line 4
    invoke-virtual {v0}, Ljava/net/Socket;->isConnected()Z

    move-result v2

    if-eqz v2, :cond_5

    const/16 v2, 0x2710

    .line 5
    invoke-virtual {v0, v2}, Ljava/net/Socket;->setSoTimeout(I)V

    .line 6
    new-instance v2, Ljava/io/DataInputStream;

    invoke-virtual {v0}, Ljava/net/Socket;->getInputStream()Ljava/io/InputStream;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/io/DataInputStream;-><init>(Ljava/io/InputStream;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_8
    .catchall {:try_start_0 .. :try_end_0} :catchall_3

    .line 7
    :try_start_1
    new-instance v3, Ljava/io/DataOutputStream;

    invoke-virtual {v0}, Ljava/net/Socket;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/io/DataOutputStream;-><init>(Ljava/io/OutputStream;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_3
    .catchall {:try_start_1 .. :try_end_1} :catchall_2

    .line 8
    :try_start_2
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "GET /hostname HTTP/1.1\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip\r\nUser-Agent: Dalvik\r\nHost: localhost\r\nContent-Length: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    sget-object v5, Les/c90;->h:Ljava/lang/String;

    .line 9
    invoke-virtual {v5}, Ljava/lang/String;->length()I

    move-result v5

    add-int/lit8 v5, v5, 0x2

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v5, "\r\n\r\n"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    const-string v5, "utf-8"

    .line 10
    invoke-virtual {v4, v5}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/io/DataOutputStream;->write([B)V

    .line 11
    sget-object v4, Les/c90;->h:Ljava/lang/String;

    invoke-virtual {v4}, Ljava/lang/String;->getBytes()[B

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/io/DataOutputStream;->write([B)V

    const-string v4, "\r\n"

    .line 12
    invoke-virtual {v4}, Ljava/lang/String;->getBytes()[B

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/io/DataOutputStream;->write([B)V

    .line 13
    invoke-virtual {v2}, Ljava/io/DataInputStream;->readLine()Ljava/lang/String;

    move-result-object v4

    const-string v5, "200 OK"

    .line 14
    invoke-virtual {v4, v5}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I

    move-result v4

    const/4 v5, -0x1

    if-eq v4, v5, :cond_4

    const/4 v4, 0x0

    const/4 v5, 0x0

    .line 15
    :cond_0
    :goto_0
    invoke-virtual {v2}, Ljava/io/DataInputStream;->readLine()Ljava/lang/String;

    move-result-object v6

    .line 16
    invoke-virtual {v6}, Ljava/lang/String;->length()I

    move-result v7

    if-nez v7, :cond_3

    if-eqz v5, :cond_2

    .line 17
    invoke-virtual {v2}, Ljava/io/DataInputStream;->readLine()Ljava/lang/String;

    move-result-object v5
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_4
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    .line 18
    :try_start_3
    invoke-virtual {v2}, Ljava/io/DataInputStream;->close()V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0

    goto :goto_1

    :catch_0
    move-exception v2

    .line 19
    invoke-virtual {v2}, Ljava/io/IOException;->printStackTrace()V

    .line 20
    :goto_1
    :try_start_4
    invoke-virtual {v3}, Ljava/io/DataOutputStream;->close()V
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_1

    goto :goto_2

    :catch_1
    move-exception v2

    .line 21
    invoke-virtual {v2}, Ljava/io/IOException;->printStackTrace()V

    .line 22
    :goto_2
    :try_start_5
    invoke-virtual {v0}, Ljava/net/Socket;->close()V
    :try_end_5
    .catch Ljava/lang/Exception; {:try_start_5 .. :try_end_5} :catch_2

    goto :goto_3

    :catch_2
    move-exception v0

    .line 23
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 24
    :goto_3
    iget-object v0, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v0}, Lcom/estrongs/android/pop/app/filetransfer/n;->a(Lcom/estrongs/android/pop/app/filetransfer/n;)Ljava/lang/Object;

    move-result-object v6

    monitor-enter v6

    if-eqz v5, :cond_1

    .line 25
    :try_start_6
    iget-object v0, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v0}, Lcom/estrongs/android/pop/app/filetransfer/n;->b(Lcom/estrongs/android/pop/app/filetransfer/n;)Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/estrongs/android/pop/app/filetransfer/n;->a(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_1

    .line 26
    iget-object v2, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->a:Ljava/lang/String;

    invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_1

    .line 27
    new-instance v0, Les/ol;

    invoke-direct {v0}, Les/ol;-><init>()V

    .line 28
    iget-object v2, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->a:Ljava/lang/String;

    iput-object v2, v0, Les/ol;->d:Ljava/lang/String;

    .line 29
    iput-object v5, v0, Les/ol;->c:Ljava/lang/String;

    .line 30
    iput-boolean v4, v0, Les/ol;->a:Z

    .line 31
    iput-object v1, v0, Les/ol;->e:Ljava/lang/String;

    .line 32
    iget-object v1, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v1}, Lcom/estrongs/android/pop/app/filetransfer/n;->c(Lcom/estrongs/android/pop/app/filetransfer/n;)Lcom/estrongs/android/pop/app/filetransfer/n$b;

    move-result-object v1

    if-eqz v1, :cond_1

    .line 33
    iget-object v1, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v1}, Lcom/estrongs/android/pop/app/filetransfer/n;->c(Lcom/estrongs/android/pop/app/filetransfer/n;)Lcom/estrongs/android/pop/app/filetransfer/n$b;

    move-result-object v1

    invoke-interface {v1, v0}, Lcom/estrongs/android/pop/app/filetransfer/n$b;->a(Les/ol;)V

    .line 34
    :cond_1
    iget-object v0, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v0}, Lcom/estrongs/android/pop/app/filetransfer/n;->d(Lcom/estrongs/android/pop/app/filetransfer/n;)J

    .line 35
    monitor-exit v6

    goto/16 :goto_c

    :catchall_0
    move-exception v0

    monitor-exit v6
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_0

    throw v0

    .line 36
    :cond_2
    :try_start_7
    new-instance v1, Ljava/lang/Exception;

    invoke-direct {v1}, Ljava/lang/Exception;-><init>()V

    throw v1

    :cond_3
    const-string v7, "Server: ES Name Response Server"

    .line 37
    invoke-virtual {v6, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_0

    const/4 v5, 0x1

    goto :goto_0

    .line 38
    :cond_4
    new-instance v1, Ljava/lang/Exception;

    invoke-direct {v1}, Ljava/lang/Exception;-><init>()V

    throw v1
    :try_end_7
    .catch Ljava/lang/Exception; {:try_start_7 .. :try_end_7} :catch_4
    .catchall {:try_start_7 .. :try_end_7} :catchall_1

    :catchall_1
    move-exception v1

    goto :goto_4

    :catchall_2
    move-exception v3

    move-object v8, v3

    move-object v3, v1

    move-object v1, v8

    goto :goto_4

    :catch_3
    move-object v3, v1

    :catch_4
    move-object v1, v2

    goto :goto_8

    .line 39
    :cond_5
    :try_start_8
    new-instance v2, Ljava/lang/Exception;

    const-string v3, "connect timeout!"

    invoke-direct {v2, v3}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    throw v2
    :try_end_8
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_8} :catch_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_3

    :catchall_3
    move-exception v2

    move-object v3, v1

    move-object v1, v2

    move-object v2, v3

    :goto_4
    if-eqz v2, :cond_6

    .line 40
    :try_start_9
    invoke-virtual {v2}, Ljava/io/DataInputStream;->close()V
    :try_end_9
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_5

    goto :goto_5

    :catch_5
    move-exception v2

    .line 41
    invoke-virtual {v2}, Ljava/io/IOException;->printStackTrace()V

    :cond_6
    :goto_5
    if-eqz v3, :cond_7

    .line 42
    :try_start_a
    invoke-virtual {v3}, Ljava/io/DataOutputStream;->close()V
    :try_end_a
    .catch Ljava/io/IOException; {:try_start_a .. :try_end_a} :catch_6

    goto :goto_6

    :catch_6
    move-exception v2

    .line 43
    invoke-virtual {v2}, Ljava/io/IOException;->printStackTrace()V

    .line 44
    :cond_7
    :goto_6
    :try_start_b
    invoke-virtual {v0}, Ljava/net/Socket;->close()V
    :try_end_b
    .catch Ljava/lang/Exception; {:try_start_b .. :try_end_b} :catch_7

    goto :goto_7

    :catch_7
    move-exception v0

    .line 45
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 46
    :goto_7
    iget-object v0, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v0}, Lcom/estrongs/android/pop/app/filetransfer/n;->a(Lcom/estrongs/android/pop/app/filetransfer/n;)Ljava/lang/Object;

    move-result-object v2

    monitor-enter v2

    .line 47
    :try_start_c
    iget-object v0, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v0}, Lcom/estrongs/android/pop/app/filetransfer/n;->d(Lcom/estrongs/android/pop/app/filetransfer/n;)J

    .line 48
    monitor-exit v2
    :try_end_c
    .catchall {:try_start_c .. :try_end_c} :catchall_4

    .line 49
    throw v1

    :catchall_4
    move-exception v0

    .line 50
    :try_start_d
    monitor-exit v2
    :try_end_d
    .catchall {:try_start_d .. :try_end_d} :catchall_4

    throw v0

    :catch_8
    move-object v3, v1

    :goto_8
    if-eqz v1, :cond_8

    .line 51
    :try_start_e
    invoke-virtual {v1}, Ljava/io/DataInputStream;->close()V
    :try_end_e
    .catch Ljava/io/IOException; {:try_start_e .. :try_end_e} :catch_9

    goto :goto_9

    :catch_9
    move-exception v1

    .line 52
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    :cond_8
    :goto_9
    if-eqz v3, :cond_9

    .line 53
    :try_start_f
    invoke-virtual {v3}, Ljava/io/DataOutputStream;->close()V
    :try_end_f
    .catch Ljava/io/IOException; {:try_start_f .. :try_end_f} :catch_a

    goto :goto_a

    :catch_a
    move-exception v1

    .line 54
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    .line 55
    :cond_9
    :goto_a
    :try_start_10
    invoke-virtual {v0}, Ljava/net/Socket;->close()V
    :try_end_10
    .catch Ljava/lang/Exception; {:try_start_10 .. :try_end_10} :catch_b

    goto :goto_b

    :catch_b
    move-exception v0

    .line 56
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 57
    :goto_b
    iget-object v0, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v0}, Lcom/estrongs/android/pop/app/filetransfer/n;->a(Lcom/estrongs/android/pop/app/filetransfer/n;)Ljava/lang/Object;

    move-result-object v0

    monitor-enter v0

    .line 58
    :try_start_11
    iget-object v1, p0, Lcom/estrongs/android/pop/app/filetransfer/n$a;->b:Lcom/estrongs/android/pop/app/filetransfer/n;

    invoke-static {v1}, Lcom/estrongs/android/pop/app/filetransfer/n;->d(Lcom/estrongs/android/pop/app/filetransfer/n;)J

    .line 59
    monitor-exit v0

    :goto_c
    return-void

    :catchall_5
    move-exception v1

    monitor-exit v0
    :try_end_11
    .catchall {:try_start_11 .. :try_end_11} :catchall_5

    goto :goto_e

    :goto_d
    throw v1

    :goto_e
    goto :goto_d
.end method
